/*
	MIDAS Context Based Routing
	cbr_triple.h
	Copyright (c) 2007 Radoslaw Olgierd Schoeneich
	MEAG IT PW
*/

#ifndef cbr_triple_h_
#define cbr_triple_h_

#include <string>
#include <list>

#include "cbr_types.h"

/**
 * Triple representing the contents of a HELLO message.
 */

class cbr_ContextModel;

class cbr_Triple : private cbr_Object {
private:
	cbr_Concept	concept;
	int		hop_cnt;
	cbr_ID		src;

public:
	cbr_Triple(const cbr_Concept& c, int hc, cbr_ID s) : concept(c)
	{
		hop_cnt = hc;
		src = s;
	}
	// creates one triple from two other ones - used for compression
	cbr_Triple(const cbr_Triple& t1, const cbr_Triple& t2,
					const cbr_ContextModel* model);

	const cbr_Concept&	getConcept() const { return concept; }
	int			getMetric() const { return hop_cnt; }
	cbr_ID			getSource() const { return src; }

	unsigned		getByteLength() const;
};

typedef std::list<cbr_Triple*> cbr_TriplesList;

void cbr_Triple_dump(const cbr_Triple *);
void cbr_TriplesList_dump(char *, const cbr_TriplesList *list);

#endif	// cbr_triple_h_
